import { Message } from 'element-ui'
// 获取日期字符串，上月最后一天或昨天，格式为：2019-10-31
export function getDateString(type, datestr) {
  let date;
  if (datestr)
    date = new Date(datestr);
  else
    date = new Date();
  if (type == "last_month_last_day") {
    date.setDate(0);
  } else if (type == "this_month_first_day") {
    date.setDate(1);
  } else if (type == "this_month_last_day") {
    if (date.getFullYear() != new Date().getFullYear()) {
      date.setFullYear(date.getFullYear())
    }
    date.setMonth(date.getMonth() + 1);
    date.setDate(0);
  } else if (type == "yesterday") {
    date.setTime(date.getTime() - 24 * 60 * 60 * 1000);
  }
  let month = date.getMonth() + 1;
  let day = date.getDate();
  if (month < 10) {
    month = "0" + month;
  }
  if (day < 10) {
    day = "0" + day;
  }
  return date.getFullYear() + "-" + month + "-" + day;
}
// Echart自适应
export function debounce(func, wait, immediate) {
  let timeout, args, context, timestamp, result
  const later = function () {
    // 据上一次触发时间间隔
    const last = +new Date() - timestamp
    // 上次被包装函数被调用时间间隔last小于设定时间间隔wait
    if (last < wait && last > 0) {
      timeout = setTimeout(later, wait - last)
    } else {
      timeout = null
      // 如果设定为immediate===true，因为开始边界已经调用过了此处无需调用
      if (!immediate) {
        result = func.apply(context, args)
        if (!timeout) context = args = null
      }
    }
  }
  return function (...args) {
    context = this
    timestamp = +new Date()
    const callNow = immediate && !timeout
    // 如果延时不存在，重新设定延时
    if (!timeout) timeout = setTimeout(later, wait)
    if (callNow) {
      result = func.apply(context, args)
      context = args = null
    }
    return result
  }
}
export const today = new Date(Date.UTC(new Date().getFullYear(), new Date().getMonth(), new Date().getDate())).toISOString().slice(0, 10).replace('-', '.').replace('-', '.');
// 建套餐未来时间选择
export function pickerOptionsAfterF() {
  return {
    shortcuts: [
      {
        text: "未来一周",
        onClick(picker) {
          const end = new Date();
          const start = new Date();
          end.setTime(start.getTime() + 3600 * 1000 * 24 * 6);
          picker.$emit("pick", [start, end]);
        }
      },
      {
        text: "未来一个月",
        onClick(picker) {
          const end = new Date();
          const start = new Date();
          end.setTime(start.getTime() + 3600 * 1000 * 24 * 30);
          picker.$emit("pick", [start, end]);
        }
      }
    ]
  }
}

//去左右空格;
export function trim(s) {
  return s.replace(/(^\s*)|(\s*$)/g, "");
}
//频率最高 时间选择不能大于otherDay默认当天，最多一个月
export function pickerOptionsF(otherDay = 0) {
  return {
    disabledDate(time) {
      return time.getTime() > Date.now() + 8.64e7 * otherDay
    },
    shortcuts: [
      {
        text: "最近一周",
        onClick(picker) {
          const end = new Date();
          const start = new Date();
          end.setTime(Date.now() + 8.64e7 * otherDay);
          start.setTime(start.getTime() - 3600 * 1000 * 24 * 6);
          picker.$emit("pick", [start, end]);
        }
      },
      {
        text: "最近一个月",
        onClick(picker) {
          const end = new Date();
          const start = new Date();
          end.setTime(Date.now() + 8.64e7 * otherDay);
          start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
          picker.$emit("pick", [start, end]);
        }
      }
    ]
  }
}

//频率最高 时间选择不能大于otherDay默认当天，最多一个年
export function pickerOptionsY(otherDay = 0) {
  return {
    disabledDate(time) {
      return time.getTime() > Date.now() + 8.64e7 * otherDay
    },
    shortcuts: [
      {
        text: "最近一周",
        onClick(picker) {
          const end = new Date();
          const start = new Date();
          end.setTime(Date.now() + 8.64e7 * otherDay);
          start.setTime(start.getTime() - 3600 * 1000 * 24 * 6);
          picker.$emit("pick", [start, end]);
        }
      },
      {
        text: "最近一个月",
        onClick(picker) {
          const end = new Date();
          const start = new Date();
          end.setTime(Date.now() + 8.64e7 * otherDay);
          start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
          picker.$emit("pick", [start, end]);
        }
      },
      {
        text: "最近一个年",
        onClick(picker) {
          const end = new Date();
          const start = new Date();
          end.setTime(Date.now() + 8.64e7 * otherDay);
          start.setTime(start.getTime() - 3600 * 1000 * 24 * 366);
          picker.$emit("pick", [start, end]);
        }
      }
    ]
  }
}
//时间选择不能大于otherDay默认当天，最多6个月
export function pickerOptionsSixMonthX(otherDay = 0) {
  return {
    disabledDate(time) {
      return time.getTime() < Date.now() + 8.64e7 * otherDay
    },
    shortcuts: [
      {
        text: "未来一周",
        onClick(picker) {
          const end = new Date();
          const start = new Date();
          end.setTime(start.getTime() + 3600 * 1000 * 24 * 6);
          picker.$emit("pick", [start, end]);
        }
      },
      {
        text: "未来一个月",
        onClick(picker) {
          const end = new Date();
          const start = new Date();
          end.setTime(start.getTime() + 3600 * 1000 * 24 * 30);
          picker.$emit("pick", [start, end]);
        }
      }
    ]
  }
}


//时间选择不能大于otherDay默认当天，最多6个月
export function pickerOptionsSixMonth(otherDay = 0) {
  return {
    disabledDate(time) {
      return time.getTime() > Date.now() + 8.64e7 * otherDay
    },
    shortcuts: [
      {
        text: "最近一周",
        onClick(picker) {
          const end = new Date();
          const start = new Date();
          end.setTime(Date.now() + 8.64e7 * otherDay);
          start.setTime(start.getTime() - 3600 * 1000 * 24 * 6);
          picker.$emit("pick", [start, end]);
        }
      },
      {
        text: "最近一个月",
        onClick(picker) {
          const end = new Date();
          const start = new Date();
          end.setTime(Date.now() + 8.64e7 * otherDay);
          start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
          picker.$emit("pick", [start, end]);
        }
      },
      {
        text: "最近六个月",
        onClick(picker) {
          const end = new Date();
          const start = new Date();
          end.setTime(Date.now() + 8.64e7 * otherDay);
          start.setTime(start.getTime() - 3600 * 1000 * 24 * 30 * 6);
          picker.$emit("pick", [start, end]);
        }
      }
    ]
  }
}
//时间选择不能大于otherDay默认当天，最多7天
export function pickerOptionsSevenDay(otherDay = 0) {
  return {
    disabledDate(time) {
      return time.getTime() > Date.now()
    },
    shortcuts: [
      {
        text: "最近一周",
        onClick(picker) {
          const end = new Date();
          const start = new Date();
          end.setTime(Date.now() + 8.64e7 * otherDay);
          start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
          picker.$emit("pick", [start, end]);
        }
      }
    ]
  }
}

//时间选择不能大于other月，默认当月
export function pickerOptionsMonth(other = 0) {
  return {
    disabledDate(time) {
      return time.getTime() > Date.now() + 8.64e7 * 30 * other
    },
  }
}

//时间选择不能小于other天，默认当天
export function pickerOptionsGtDay(other = 0) {
  return {
    disabledDate(time) {
      return time.getTime() < Date.now() - 8.64e7 * (other+1)
    },
  }
}

//时间选择不能小于 当前时间（天，小时），默认当天, 最多一个月
export function pickerOptionsGtDayHours() {
  return {
    disabledDate(time) {
      let dateTime = new Date();
      let startDateTime = dateTime.setDate(dateTime.getDate() - 1);
      let endDateTime = dateTime.setDate(dateTime.getDate() + 31);
      return (
          time.getTime() < new Date(startDateTime).getTime() ||
          time.getTime() > new Date(endDateTime).getTime()
      );
    },
    selectableRange:
        new Date(new Date().setHours(6)) + ':00:00 - 23:59:59'
  }
}

export function pickerOptionsMonthFive() {
  return {
    disabledDate(time) {
      return time.getTime() < new Date('2020-05').getTime();
    },
  }
}

//频率最高 开始结束时间默认当天
export function pickerDateDot(start = 0, end = 0) {
  return [new Date(Date.UTC(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()) + start).toISOString().slice(0, 10), new Date(Date.UTC(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()) + end).toISOString().slice(0, 10)]
}

//频率最高 开始结束时间默认当天
export function pickerDateF(start = 0, end = 0) {
  return [new Date(Date.UTC(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()) + start).toISOString().slice(0, 10).replace('-', '.').replace('-', '.'), new Date(Date.UTC(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()) + end).toISOString().slice(0, 10).replace('-', '.').replace('-', '.')]
}

//开始时间一周前，结束时间默认当天
export function pickerDateSevenDays(start = 0, end = 0) {
  const startSix = new Date();
  startSix.setTime(startSix.getTime() - 3600 * 1000 * 24 * 6);
  return [new Date(Date.UTC(startSix.getFullYear(), startSix.getMonth(), startSix.getDate()) + start).toISOString().slice(0, 10).replace('-', '.').replace('-', '.'), new Date(Date.UTC(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()) + end).toISOString().slice(0, 10).replace('-', '.').replace('-', '.')]
}
//开始时间1个月前，结束时间默认当天
export function pickerDateOneMonth(start = 0, end = 0) {
  const startTime = new Date();
  startTime.setTime(startTime.getTime() - 3600 * 1000 * 24 * 30);
  return [new Date(Date.UTC(startTime.getFullYear(), startTime.getMonth(), startTime.getDate()) + start).toISOString().slice(0, 10), new Date(Date.UTC(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()) + end).toISOString().slice(0, 10)]
}
//开始时间6个月前，结束时间默认当天
export function pickerDateSixMonth(start = 0, end = 0) {
  const startSix = new Date();
  startSix.setTime(startSix.getTime() - 3600 * 1000 * 24 * 30 * 6);
  return [new Date(Date.UTC(startSix.getFullYear(), startSix.getMonth(), startSix.getDate()) + start).toISOString().slice(0, 10).replace('-', '.').replace('-', '.'), new Date(Date.UTC(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()) + end).toISOString().slice(0, 10).replace('-', '.').replace('-', '.')]
}

// 最大可选时间区间，最多33天
export function optionMaxTime(pickerDate) {
  return new Promise(resolve => {
    if ((new Date(pickerDate[1]).getTime() - new Date(pickerDate[0]).getTime()) / 86400000 >= 33) {
      Message({ type: 'error', message: '所选时间区间最大为33天' });
    } else {
      resolve()
    }
  })
}
// 最大可选时间区间，最多198天
export function optionMaxTime198(pickerDate) {
  return new Promise(resolve => {
    if ((new Date(pickerDate[1]).getTime() - new Date(pickerDate[0]).getTime()) / 86400000 >= 198) {
      Message({ type: 'error', message: '所选时间区间最大为198天' });
    } else {
      resolve()
    }
  })
}
// 最大可选时间区间，最多369天
export function optionMaxTime369(pickerDate) {
  return new Promise(resolve => {
    if ((new Date(pickerDate[1]).getTime() - new Date(pickerDate[0]).getTime()) / 86400000 >= 369) {
      Message({ type: 'error', message: '所选时间区间最大为369天' });
    } else {
      resolve()
    }
  })
}
// 最大可选时间区间，最多7天
export function optionMaxTime7(pickerDate) {
  return new Promise(resolve => {
    if ((new Date(pickerDate[1]).getTime() - new Date(pickerDate[0]).getTime()) / 86400000 >= 7) {
      Message({ type: 'error', message: '所选时间区间最大为7天' });
    } else {
      resolve()
    }
  })
}
// 是否今天
export function isToday(str) {
  return new Date().getTime() - new Date(str).getTime() < 86400000;
}
// 是否为7天
export function isSevenDays(pickerDate) {
  return (new Date(pickerDate[1]).getTime() - new Date(pickerDate[0]).getTime()) / 86400000 == 6;
}
// 自定义提示文字表头
export function renderHeader(h, { column, $index }, title, isShow = 0) {
  if (isShow == 0) {
    return h('span', {}, [
      h('el-popover', { props: { placement: 'bottom', trigger: 'hover', content: title } }, [
        h('span', { slot: 'reference' }, column.label),
      ])
    ])
  } else {
    return h('span', { slot: 'reference' }, column.label)
  }
}
// // 自定义提示checkbox表头
// export function renderCheckboxHeader(h, { column, $index }, title) {
//   return h('', {}, [
//     h('el-popover', { props: { placement: 'bottom', trigger: 'hover', content: title } }, [
//       h('span', { slot: 'reference' }, column.label),
//     ])
//   ])
//}

//对象数组排序 key--要进行排序的属性  order--排序方式（1-由大到小，0-由小到大）
export function sortBy(key, order) {
  return (a, b) => {
    if (order == 1) {
      return b[key] - a[key]
    } else {
      return a[key] - b[key]
    }
  }
}

//获取礼品单位
export function giftUnit(id) {
  let list = ["个", "包", "捆", "条", "扎", "桶", "打"];
  if (id) {
    return list[id];
  } else {
    return "个";
  }
}

//采购单环节 status:状态码 is_coo:是否经过运营总监审批 is_gm:是否经过总经办审批 type:是否为采购平台下单
export function getBuyOrderLines(status, is_coo, is_gm, type) {
  let pLinks = [];
  if (type) {
    switch (status) {
      case "24":
        pLinks = [{ name: "采购下单", type: 2 }, { name: "已关闭", type: -1 }]
        break;
      case "20":
        pLinks = [{ name: "采购下单", type: 2 }, { name: "礼品部审批", type: 1 }, { name: "下单成功", type: 0 }]
        break;
      case "23":
        pLinks = [{ name: "采购下单", type: 1 }, { name: "礼品部审批", type: 0 }, { name: "下单成功", type: 0 }]
        break;
      case "25":
        pLinks = [{ name: "采购下单", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "已关闭", type: -1 }]
        break;
      case "22":
        if (is_coo == 0) {
          pLinks = [{ name: "采购下单", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "下单成功", type: 2 }]
        } else {
          pLinks = [{ name: "采购下单", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "运营总监审批", type: 1 }, { name: "下单成功", type: 0 }]
        }
        break;
      case "31":
        pLinks = [{ name: "采购下单", type: 1 }, { name: "礼品部审批", type: 0 }, { name: "运营总监审批", type: 0 }, { name: "下单成功", type: 0 }]
        break;
      case "32":
        pLinks = [{ name: "采购下单", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "运营总监审批", type: 2 }, { name: "已关闭", type: -1 }]
        break;
      case "30":
        if (is_gm == 0) {
          pLinks = [{ name: "采购下单", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "运营总监审批", type: 2 }, { name: "下单成功", type: 2 }]
        } else {
          pLinks = [{ name: "采购下单", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "运营总监审批", type: 2 }, { name: "总经办审批", type: 1 }, { name: "下单成功", type: 0 }]
        }
        break;
      case "41":
        pLinks = [{ name: "采购下单", type: 1 }, { name: "礼品部审批", type: 0 }, { name: "运营总监审批", type: 0 }, { name: "总经办审批", type: 0 }, { name: "下单成功", type: 0 }]
        break;
      case "42":
        pLinks = [{ name: "采购下单", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "运营总监审批", type: 2 }, { name: "总经办审批", type: 2 }, { name: "已关闭", type: -1 }]
        break;
      case "40":
        pLinks = [{ name: "采购下单", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "运营总监审批", type: 2 }, { name: "总经办审批", type: 2 }, { name: "下单成功", type: 2 }]
        break;
      default:
        break;
    }
    return pLinks;
  }
  switch (status) {
    case "5":
      pLinks = [{ name: "采购下单", type: 2 }, { name: "已关闭", type: -1 }]
      break;
    case "12":
      pLinks = [{ name: "采购下单", type: 1 }, { name: "店长审批", type: 0 }, { name: "业务专员审批", type: 0 }, { name: "礼品部审批", type: 0 }, { name: "下单成功", type: 0 }]
      break;
    case "10":
      pLinks = [{ name: "采购下单", type: 2 }, { name: "店长审批", type: 1 }, { name: "业务专员审批", type: 0 }, { name: "礼品部审批", type: 0 }, { name: "下单成功", type: 0 }]
      break;
    case "21":
      pLinks = [{ name: "采购下单", type: 1 }, { name: "店长审批", type: 0 }, { name: "业务专员审批", type: 0 }, { name: "礼品部审批", type: 0 }, { name: "下单成功", type: 0 }]
      break;
    case "13":
      pLinks = [{ name: "采购下单", type: 2 }, { name: "店长审批", type: 2 }, { name: "已关闭", type: -1 }]
      break;
    case "11":
      pLinks = [{ name: "采购下单", type: 2 }, { name: "店长审批", type: 2 }, { name: "业务专员审批", type: 1 }, { name: "礼品部审批", type: 0 }, { name: "下单成功", type: 0 }]
      break;
    case "23":
      pLinks = [{ name: "采购下单", type: 1 }, { name: "店长审批", type: 0 }, { name: "业务专员审批", type: 0 }, { name: "礼品部审批", type: 0 }, { name: "下单成功", type: 0 }]
      break;
    case "24":
      pLinks = [{ name: "采购下单", type: 2 }, { name: "店长审批", type: 2 }, { name: "业务专员审批", type: 2 }, { name: "已关闭", type: -1 }]
      break;
    case "20":
      pLinks = [{ name: "采购下单", type: 2 }, { name: "店长审批", type: 2 }, { name: "业务专员审批", type: 2 }, { name: "礼品部审批", type: 1 }, { name: "下单成功", type: 0 }]
      break;
    case "25":
      pLinks = [{ name: "采购下单", type: 2 }, { name: "店长审批", type: 2 }, { name: "业务专员审批", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "已关闭", type: -1 }]
      break;
    case "22":
      if (is_coo == 0) {
        pLinks = [{ name: "采购下单", type: 2 }, { name: "店长审批", type: 2 }, { name: "业务专员审批", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "下单成功", type: 2 }]
      } else {
        pLinks = [{ name: "采购下单", type: 2 }, { name: "店长审批", type: 2 }, { name: "业务专员审批", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "运营总监审批", type: 1 }, { name: "下单成功", type: 0 }]
      }
      break;
    case "31":
      pLinks = [{ name: "采购下单", type: 1 }, { name: "店长审批", type: 0 }, { name: "业务专员审批", type: 0 }, { name: "礼品部审批", type: 0 }, { name: "运营总监审批", type: 0 }, { name: "下单成功", type: 0 }]
      break;
    case "32":
      pLinks = [{ name: "采购下单", type: 2 }, { name: "店长审批", type: 2 }, { name: "业务专员审批", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "运营总监审批", type: 2 }, { name: "已关闭", type: -1 }]
      break;
    case "30":
      if (is_gm == 0) {
        pLinks = [{ name: "采购下单", type: 2 }, { name: "店长审批", type: 2 }, { name: "业务专员审批", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "运营总监审批", type: 2 }, { name: "下单成功", type: 2 }]
      } else {
        pLinks = [{ name: "采购下单", type: 2 }, { name: "店长审批", type: 2 }, { name: "业务专员审批", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "运营总监审批", type: 2 }, { name: "总经办审批", type: 1 }, { name: "下单成功", type: 0 }]
      }
      break;
    case "41":
      pLinks = [{ name: "采购下单", type: 1 }, { name: "店长审批", type: 0 }, { name: "业务专员审批", type: 0 }, { name: "礼品部审批", type: 0 }, { name: "运营总监审批", type: 0 }, { name: "总经办审批", type: 0 }, { name: "下单成功", type: 0 }]
      break;
    case "42":
      pLinks = [{ name: "采购下单", type: 2 }, { name: "店长审批", type: 2 }, { name: "业务专员审批", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "运营总监审批", type: 2 }, { name: "总经办审批", type: 2 }, { name: "已关闭", type: -1 }]
      break;
    case "40":
      pLinks = [{ name: "采购下单", type: 2 }, { name: "店长审批", type: 2 }, { name: "业务专员审批", type: 2 }, { name: "礼品部审批", type: 2 }, { name: "运营总监审批", type: 2 }, { name: "总经办审批", type: 2 }, { name: "下单成功", type: 2 }]
      break;
    default:
      break;
  }
  return pLinks;
}

//合并单环节
export function getMOrderLines(status) {
  let pLinks = [];
  switch (status) {
    case "10":
      pLinks = [{ name: "生成合并单", type: 2 }, { name: "合并单确认", type: 1 }, { name: "采购部审批", type: 0 }, { name: "财务经理审批", type: 0 }, { name: "总经办审批", type: 0 }, { name: "采购确认成功", type: 0 }]
      break;
    case "21":
      pLinks = [{ name: "生成合并单", type: 2 }, { name: "合并单确认", type: 1 }, { name: "采购部审批", type: 0 }, { name: "财务经理审批", type: 0 }, { name: "总经办审批", type: 0 }, { name: "采购确认成功", type: 0 }]
      break;
    case "12":
      pLinks = [{ name: "生成合并单", type: 2 }, { name: "合并单确认", type: 2 }, { name: "已关闭", type: -1 }]
      break;
    case "11":
      pLinks = [{ name: "生成合并单", type: 2 }, { name: "合并单确认", type: 2 }, { name: "已撤销", type: -1 }]
      break;
    case "22":
      pLinks = [{ name: "生成合并单", type: 2 }, { name: "合并单确认", type: 2 }, { name: "采购部审批", type: 2 }, { name: "已关闭", type: -1 }]
      break;
    case "20":
      pLinks = [{ name: "生成合并单", type: 2 }, { name: "合并单确认", type: 2 }, { name: "采购部审批", type: 1 }, { name: "财务经理审批", type: 0 }, { name: "总经办审批", type: 0 }, { name: "采购确认成功", type: 0 }]
      break;
    case "31":
      pLinks = [{ name: "生成合并单", type: 2 }, { name: "合并单确认", type: 2 }, { name: "采购部审批", type: 1 }, { name: "财务经理审批", type: 0 }, { name: "总经办审批", type: 0 }, { name: "采购确认成功", type: 0 }]
      break;
    case "32":
      pLinks = [{ name: "生成合并单", type: 2 }, { name: "合并单确认", type: 2 }, { name: "采购部审批", type: 2 }, { name: "财务经理审批", type: 2 }, { name: "已关闭", type: -1 }]
      break;
    case "30":
      pLinks = [{ name: "生成合并单", type: 2 }, { name: "合并单确认", type: 2 }, { name: "采购部审批", type: 2 }, { name: "财务经理审批", type: 1 }, { name: "总经办审批", type: 0 }, { name: "采购确认成功", type: 0 }];
      break;
    case "41":
      pLinks = [{ name: "生成合并单", type: 2 }, { name: "合并单确认", type: 2 }, { name: "采购部审批", type: 2 }, { name: "财务经理审批", type: 1 }, { name: "总经办审批", type: 0 }, { name: "采购确认成功", type: 0 }];
      break;
    case "40":
      pLinks = [{ name: "生成合并单", type: 2 }, { name: "合并单确认", type: 2 }, { name: "采购部审批", type: 2 }, { name: "财务经理审批", type: 2 }, { name: "总经办审批", type: 1 }, { name: "采购确认成功", type: 0 }];
      break;
    case "42":
      pLinks = [{ name: "生成合并单", type: 2 }, { name: "合并单确认", type: 2 }, { name: "采购部审批", type: 2 }, { name: "财务经理审批", type: 2 }, { name: "总经办审批", type: 2 }, { name: "已关闭", type: -1 }];
      break;
    case "50":
      pLinks = [{ name: "生成合并单", type: 2 }, { name: "合并单确认", type: 2 }, { name: "采购部审批", type: 2 }, { name: "财务经理审批", type: 2 }, { name: "总经办审批", type: 2 }, { name: "采购确认成功", type: 2 }];
      break;
    default:
      break;
  }
  return pLinks;
}

//获取商品类别
export function getGoodsType(i){
  let type="";
  switch (i/1) {
    case 1:
      type="代金券";
      break;
    case 2:
      type="办卡";
      break;
    case 3:
      type="充值";
      break;
    case 4:
      type="续期";
      break;
    case 5:
      type="门票";
      break;
    case 6:
      type="企划";
      break;
    case 7:
      type="实物";
      break;
    case 8:
      type="凭证兑换";
      break;
    default:
      break;
  }
  return type;
}
